<template>
  <scroll-view :scroll-y="true" class="scroll-view">
    <view
      class="item flexr align-center"
      v-for="(order, index) in userStore.allOrders"
      :key="index"
      @click="goOrderDetail(order)"
    >
      <view class="flexc flex-1 overflow-hidden">
        <view class="title-item">{{ order.storeName }}</view>
        <view>订单号: {{ order.orderNumber }}</view>
        <view class="time-item">{{ order.placeOrderTime }}</view>
      </view>
      <view class="score-item" >{{ order.billAmount }}</view>
    </view>
  </scroll-view>
</template>

<script setup>
import { onLaunch, onShow, onHide, onLoad } from "@dcloudio/uni-app";
import { useUserStore } from "@/store/user";
import { ref, watch } from "vue";
const userStore = useUserStore();
onLoad((options) => {
    userStore.getCustomerAllOrder();
});
function goOrderDetail(order) {
  uni.navigateTo({
    url: `/subpages/my/orderDetail?orderNumber=${order.orderNumber}`,
  });
}
</script>

<style lang="scss">
.scroll-view {
  background-color: white;
  flex: 1;
  overflow-y: scroll;
  padding: 32rpx 0;
  padding-top: 12rpx;
  padding-bottom: env(safe-area-inset-bottom);
  .item {
    border-bottom: 2rpx solid $divider-color;
    padding-bottom: 20rpx;
    padding-top: 20rpx;
		padding-left: 32rpx;
		padding-right: 32rpx;
  }
  .title-item {
    font-size: 32rpx;
    margin-bottom: 10rpx;
  }
  .time-item {
    font-size: 24rpx;
    color: $text-color2;
  }
  .score-item {
    color: black;
    font-size: 48rpx;
    margin-top: 4rpx;
  }
}
</style>
